# IV_models.R 

# Part of the replication archive for 
#
#   Bullock, John G. 2020. "Education and Attitudes toward Redistribution in
#   the United States." British Journal of Political Science 50.


# This file specifies the main IV models that are used in the article -- most
# notably in Figure 2.



library(Formula)  # for Formula()


# Baseline model
eqwlth.mod1 <- Formula(
  eqwlth ~ educ       + yearYoungNorm + female + race + bornInUS + stateYoung + yearInt.fac + poly(age, 4, raw = FALSE) + state.contemp | 
           (CA.fac)   + yearYoungNorm + female + race + bornInUS + stateYoung + yearInt.fac + poly(age, 4, raw = FALSE) + state.contemp)


# Adding cohort-year fixed effects  
eqwlth.mod2 <- update(
    eqwlth.mod1, 
    . ~ . - yearYoungNorm + factor(yearYoungNorm) | 
        . - yearYoungNorm + factor(yearYoungNorm))       

# Adding state-when-young * year-when-young trends       
  eqwlth.mod3 <- update(
    eqwlth.mod1, 
    . ~ . + stateYoung:yearYoungNorm | 
        . + stateYoung:yearYoungNorm)
  
# Adding demographic and political controls  
eqwlth.mod4 <- update(
  eqwlth.mod1, 
  . ~ . + Dem.2p + VAP.turnout + Dem.2p:yearYoungNorm + blackPostBrown + MSDuringRepeal + SCDuringRepeal + RepublicanPresident + USHouseMedian + percentBlack + percentForeignBorn + percentUrban + percentWorkInManufacturing + doctorsPerCapita + higherEdEnrollmentPerCapImputed + teacherStudentRatio + blendedTeacherSalaries | 
      . + Dem.2p + VAP.turnout + Dem.2p:yearYoungNorm + blackPostBrown + MSDuringRepeal + SCDuringRepeal + RepublicanPresident + USHouseMedian + percentBlack + percentForeignBorn + percentUrban + percentWorkInManufacturing + doctorsPerCapita + higherEdEnrollmentPerCapImputed + teacherStudentRatio + blendedTeacherSalaries)
